package vn.demand.dragon.model.business
{
	import mx.controls.Alert;
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	import mx.rpc.http.HTTPService;
	
	import vn.demand.dragon.model.vo.Company;
	
	public class SaveCompanyDelegate
	{
		private var service : HTTPService;
		private var responder : IResponder;
		
		public function SaveCompanyDelegate(responder:IResponder)
		{
			service = new HTTPService();
			service.url = "http://dev.dragon.com/index.php?m=companies&a=company_quick_add&suppressHeaders=1"
			service.method = 'POST';
			service.resultFormat = 'e4x';
			this.responder = responder;
		}
		
		public function saveCompany(companyVO:Company):void {
			var token : AsyncToken = service.send(companyVO);
			token.addResponder( responder );
			token.action = 'saveCompany';
			token.companyVO = companyVO;
		}

	}
}